package com.zhijiang;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.util.Date;
import java.util.concurrent.atomic.AtomicReference;

/**
 * @author 75936
 * @version 1.0
 * @project zhiJiangHealthBureau
 * @description
 * @date 2022-12-14 17:05:26
 */

@SpringBootApplication
@Slf4j
@MapperScan("com.zhijiang.**.mapper")
@EnableScheduling
public class ApplicationApp {
    public static void main(String[] args) {
        SpringApplication.run(ApplicationApp.class, args);
        log.info("程序正常启动");
    }
    private AtomicReference<Thread> cas = new AtomicReference<Thread>();

    public void lock() {
        Thread current = Thread.currentThread();
        // 利用CAS
        while (!cas.compareAndSet(null, current)) {
            Date date = new Date();
            log.info(date.toString());
            // DO nothing
        }
    }


}
